home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TILER.ARJ / DEMODRAW.C < prev    next >
C/C++ Source or Header  |  1992-02-24  |  2KB  |  51 lines

  1. /*
  2.  *    When it opens the file it reads drive C.
  3.  *    If you are running it off a different drive
  4.  *  then change the drive.
  5.  */
  6.  
  7. #define TOTAL   256
  8. #include <stdio.h>
  9. #include <graph.h>
  10. #include <conio.h>
  11.  
  12. FILE *file;  /* Define file pointer */
  13.  
  14. main (void)
  15. {
  16.         char pict[TOTAL];
  17.         short ctr;  /* Define a counter */
  18.         short stop;
  19.         short width, length;
  20.  
  21.         /* Fill variables */
  22.         stop = 0;
  23.         width = 16;  /* width of tile */
  24.         length = 16;  /* length of tile */
  25.  
  26.     _setvideomode(_MRES256COLOR);  /* This makes the 256 color mode */
  27.         
  28.     file = fopen("C:\\TILER\\DEMO\\FIGHTY.CLP", "r+b");  /* Open file "FIGHTY.CLP" */
  29.  
  30.         if (file == NULL) {                  /* Checks to see if */
  31.                 printf ("File not found.");  /* the file "FIGHTY.CLP" */
  32.                 return (-1);                 /* is actually there.  */
  33.         } /* End If */
  34.  
  35.         for (ctr = 0; ctr < TOTAL; ctr++) {
  36.                 pict[ctr] = (char)(fgetc(file));  /* See that the file is     */
  37.         } /* End For Loop */                      /* within array boundaries  */
  38.                                                   /* and puts the file into   */
  39.                                                   /* the array.               */
  40.  
  41.     _putimage(100, 100, pict, _GPSET);  /* Puts image on screen */
  42.     
  43.         fclose(file);  /* Close the file */
  44.     
  45.     getch();  /* Wait for person to press a key. */
  46.  
  47.     _setvideomode(_DEFAULTMODE);  /* This returns the screen to normal */
  48.  
  49. } /* End of Main */
  50.  
  51.